//获取下拉数据-Hook
import { reactive, toRefs, onMounted } from 'vue';
import { TxIvcOrgQueryList, TxIvcUsableNodeQueryList} from '/@/api/its/camera.ts'
export function useDropdownData(){
    const state: any = reactive({
        n_AccessProtocolOption: [
            {label: 'RTMP', value: 1},
            {label: 'GB', value: 2},
        ],
        n_TypeOption: [
            {label: 'IPC', value: 1},
            {label: 'NVR', value: 2},
        ],
        n_TransportProtocolOption: [
            {label: 'UDP', value: 1},
            {label: 'TCP', value: 2},
        ],
        v_OrganizationOption: [],
        v_ClusterOption: [],

    })
    //获取智能计算平台组织机构
    const getOrgData = async () => {
        let res: any = await TxIvcOrgQueryList();
        if(res.success){
            state.v_OrganizationOption = res.data || []
        }
    }
    //获取智能计算平台可用结点
    const getUsableNodeData = async () => {
        let res: any = await TxIvcUsableNodeQueryList();
        if(res.success){
            state.v_ClusterOption = res.data || []
        }
    }
    onMounted(() => {
        getOrgData()
        getUsableNodeData()
    })
    return {
        ...toRefs(state)
    }
}